<?php

namespace INT\AdminBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\ORM\EntityRepository;
class SeanceType extends AbstractType {

    public function buildForm(FormBuilderInterface $builder, array $options) {
        $builder
                ->add('numero')
                ->add('enseignant', 'entity', array(
                    'class' => 'INTUserBundle:User',
                    'query_builder' => function(EntityRepository $er) {
                        return $er->createQueryBuilder('u')
                                ->where('u.grad_ens IS NOT NULL')
                                ;
                    }))
                ->add('matiere')
                ->add('salle')
                ->add('filiere')
                ->add('heure_debut', 'hidden')
                ->add('jour', 'hidden')
                ->add('heure_fin', 'hidden')
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'INT\AdminBundle\Entity\Seance'
        ));
    }

    public function getName() {
        return 'int_adminbundle_seancetype';
    }

}
